<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>博客管理注册</title>
  <link href="../static/images/favicon.ico" th:href="@{/images/me.jpg}" rel="icon" type="image/x-ico">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>

<br>
<br>
<br>
 <div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
   <div class="ur container">
     <div class="ui middle aligned center aligned grid">
       <div class="column">
         <h2 class="ui teal image header">
           <div class="content">
             管理员后台注册
           </div>
         </h2>
         <form class="ui large form" method="post" action="#" th:action="@{/admin/registerSuccess}">
           <div class="ui  segment">
             <div class="field">
               <div class="ui left icon input">
                 <i class="user icon"></i>
                 <input type="text" name="username" placeholder="用户名" >
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="text" name="email" placeholder="邮箱" >
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="password" name="password" placeholder="密码" >
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="password" name="password2" placeholder="确认密码" >
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="text" name="avatar" placeholder="用户头像链接" >
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="text" name="nickname" placeholder="昵称" >
               </div>
             </div>
             <button class="ui fluid large teal submit button">注 册</button>
           </div>

           <div class="ui error mini message"></div>
           <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}">用户名，邮箱或密码错误</div>

         </form>

       </div>
     </div>
   </div>
 </div>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>


<script>
  $('.ui.form').form({
    fields : {
      username : {
        identifier: 'username',
        rules: [{
          type : 'empty',
          prompt: '请输入用户名'
        }]
      },
      email : {
        identifier: 'email',
        rules: [{
          type : 'empty',
          prompt: '请输入邮箱'
        }]
      },
      password : {
        identifier: 'password',
        rules: [{
          type : 'empty',
          prompt: '请输入密码'
        }]
      },
      password2 : {
        identifier: 'password2',
        rules: [{
          type : 'empty',
          prompt: '请再次确认密码'
        }]
      },
      avatar : {
        identifier: 'avatar',
        rules: [{
          type : 'empty',
          prompt: '请输入用户头像链接'
        }]
      },
      nickname : {
        identifier: 'nickname',
        rules: [{
          type : 'empty',
          prompt: '请输入昵称'
        }]
      }
    }
  });

  // //利用正则表达式判断密码符合否
  // function checkpwd() {
  //   var check;
  //   var reg = /[^A-Za-z0-9_]+/;
  //   var regs = /^[a-zA-Z0-9_\u4e00-\u9fa5] + $ /;
  //   var password = document.getElementById("password").value;
  //   if (password.length < 6 || password.length > 18 || regs.test(password)) {
  //     alert("密码输入不合法，请重新输入！");
  //     document.getElementById("password").focus();
  //     check = false;
  //   } else {
  //     document.getElementById("checktext2").innerHTML = "* 密码由6-18位字符组成，且必须包含字母、数字和标点符号 √";
  //     check = true;
  //   }
  //   return check;
  // }
  // //验证密码是否不一致！
  // function checkpwdc() {
  //   var check;
  //   var password = document.getElementById("password").value;
  //   var password2 = document.getElementById("password2").value;
  //   if (password != password2) {
  //     alert("两次输入密码不一致，请重新输入！");
  //     document.getElementById("password2").focus();
  //     check = false;
  //   }
  //   // else {
  //   //   document.getElementById("checktext3").innerHTML = "* 请再次输入你的密码 √";
  //   //   check = true;
  //   // }
  //   return check;
  // }

</script>

</body>
</html>